package com.kovell.flex.test
{
	import mx.containers.Canvas;
	import mx.styles.StyleManager;

	public class GradientCanvas extends Canvas
	{
		public function GradientCanvas()
		{
		}
		
		protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
			
			var fillColors : Array = getStyle ("fillColors");
			var fillAlphas : Array = getStyle ("fillAlphas");
			var cornerRadius : Number = getStyle ("cornerRadius");
			
			// converts the fill colors to RGB color values
			StyleManager.getColorNames (fillColors);
			
			// ready to draw!
			graphics.clear ();			
			drawRoundRect (0, 0, unscaledWidth, unscaledHeight, cornerRadius, fillColors, fillAlphas, verticalGradientMatrix (0, 0, unscaledWidth, unscaledHeight));
		}
	}
}